#include "stm32f10x.h"
#include "delay.h"
#include "debug.h"
uint16_t count = 0;
void basetimer_init(void);
int main()
{
    uart_init();
    basetimer_init();
    while (1)
        ;
}
void basetimer_init(void)
{
    RCC->APB1ENR |= RCC_APB1ENR_TIM6EN;
    TIM6->PSC = 7200 - 1;
    TIM6->ARR = 10000 - 1;
    // TIM6->CR1 |= TIM_CR1_URS;
    // TIM6->EGR |= TIM_EGR_UG;
    TIM6->SR &= ~TIM_SR_UIF;
    TIM6->DIER |= TIM_DIER_UIE;
    NVIC_SetPriorityGrouping(3);
    NVIC_SetPriority(TIM6_IRQn, 1);
    NVIC_EnableIRQ(TIM6_IRQn);
    TIM6->CR1 |= TIM_CR1_CEN;
}
void TIM6_IRQHandler(void)
{
    TIM6->SR &= ~TIM_SR_UIF;
    printf("һ");
}
/****************************************   hal  ****************************************/
// void main(void)
// {
//     __HAL_TIM_CLEAR_FLAG(&htim6, TIM_FLAG_UPDATE);
//     HAL_TIM_Base_Start_IT(&htim6);
// }
// void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
// {
//     if (htim->Instance == TIM6)
//     {
//         printf("time\n");
//     }
// }
